export const dateFormat = (time, format) => {
  var date = new Date(time);
  var padStart = function (i) {
    return (i < 10 ? "0" : "") + i;
  };
  return format.replace(/yyyy|MM|dd|hh|mm|ss/g, function (a) {
    switch (a) {
      case "yyyy":
        return padStart(date.getFullYear());
      case "MM":
        return padStart(date.getMonth() + 1);
      case "mm":
        return padStart(date.getMinutes());
      case "dd":
        return padStart(date.getDate());
      case "hh":
        return padStart(date.getHours());
      case "ss":
        return padStart(date.getSeconds());
    }
  });
};
